from quant.data_utils import read_matches

ratio_low = 1.9
ratio_high = 2.2


def run():
    matches = read_matches()
    key_list = list(matches.keys())
    for i in range(len(key_list) - 1):
        matchA = matches[key_list[i]]
        for j in range(i + 1, len(key_list)):
            matchB = matches[key_list[j]]

            ratioA_list = [matchA.win, matchA.draw, matchA.lose,matchA.rangqiu_win,matchA.rangqiu_draw,matchA.rangqiu_lose]
            ratioB_list = [matchB.win, matchB.draw, matchB.lose,matchB.rangqiu_win,matchB.rangqiu_draw,matchB.rangqiu_lose]
            optionA_list = ["胜", "平", "负", "让胜", "让平", "让负"]
            optionB_list = ["胜", "平", "负", "让胜", "让平", "让负"]
            for ii in range(len(ratioA_list)):
                for jj in range(len(ratioB_list)):
                    ratioA = float(ratioA_list[ii])
                    ratioB = float(ratioB_list[jj])
                    optionA = optionA_list[ii]
                    optionB = optionB_list[jj]
                    ratio = round(ratioA * ratioB, 2)
                    if ratio >= ratio_low and ratio <= ratio_high:
                        print(
                            f"{ratio} {matchA.no} {matchA.home_team}-{matchA.away_team} {optionA}({ratioA}) "
                            f"X {matchB.no} {matchB.home_team}-{matchB.away_team} {optionB}({ratioB})")


if __name__ == '__main__':
    run()
